package com.silp.baitap1;

import java.util.Arrays;

public class array1 {

	private static int[] mang;
	private static int sum;
	private static int max;
	private static int sum1;
	private static int min;
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		//Tao mang
		int i;
		mang = new int[] {96,15,49,44,47,82,28,16,18,27,100,71,94,47,27};
		System.out.println("In ra mang :");
		for(i=0;i<mang.length;i++){
			if (i<mang.length-1){
			System.out.print(mang[i]+"-");
			}
			else
				System.out.print(mang[i]);
			
		}
		System.out.println("\n");
		for(i=0;i<mang.length-1;i++){
			if(mang[i]%3==0){
				System.out.println("So chia het cho 3 trong mang la "+mang[i]);
				
			}
		}
		for(i=1;i<mang.length;i+=2){
			
				System.out.println("Phan tu le "+mang[i]);
			
		}
		for(i=0;i<mang.length;i++){
			sum+=mang[i];
		}
		System.out.println("Tong cac phan tu trong mang "+sum);
		for(i=0;i<mang.length;i++){
			if(mang[i]/10>5){
				sum1+=mang[i];
			}
		}
		System.out.println("Tong cac phan tu trong mang co phan chuc lon hon 5 "+sum1);
		//Lay phan tu lon nhat cua mang
		max=mang[0];
		for(i=0;i<mang.length;i++){
			
			if (mang[i]>max) {
				max=mang[i];
			}
				
		}
		System.out.println("Phan tu lon nhat trong mang la "+max);
		//Lay phan tu lon nhat cua mang
		
		//Lay phan tu nho nhat cua mang
		min=mang[0];
		for(i=0;i<mang.length;i++){
			
			if (mang[i]<min) {
				min=mang[i];
			}
				
		}
		System.out.println("Phan tu nho nhat trong mang la "+min);
		//Lay phan tu nho nhat cua mang
		for(i=0;i<mang.length;i++){
			Arrays.sort(mang);
		System.out.println(mang[i]);
		}
	}
}
